local blaze = require "blaze"
local app = require "app"

local lib = blaze.app.new({
    on_splashscreen = blaze.noop,
    on_start = function()
        local lang = app.store.setting.state.lang
        local db = blaze.config.load(string.format("club/threecard/casinolib/i18n/%s.lua", lang))
        app.i18n.add("club.threecard.casinolib", db)

        local bank = app.audio.create_bank(app, "club.threecard.casinolib", {
            actions = require("blaze.audio.actions"),
            soundbank = blaze.config.load("club/threecard/casinolib/soundbank.lua")
        })
        app.audio.add_bank(bank)

        local game = app.game.running
        game.store.add_searcher("club.threecard.casinolib")
    end,
    
    on_exited = function(self)
        app.audio.remove_bank("club.threecard.casinolib")
        app.i18n.remove("club.threecard.casinolib")

        local game = app.game.running
        game.store.remove_searcher("club.threecard.casinolib")
    end
})

return lib